<!-- 文字配置 -->
<template>
  <div style="margin-top: 16px">
    <el-form-item label="文本内容">
      <el-input v-model="main.activeObj.option.data.value"></el-input>
    </el-form-item>
    <el-form-item label="字体">
      <span class="l_color_box r_margin_right8">
        <l-input-color
          v-model="myConfig.color"
          :notInput="true"
        ></l-input-color>
      </span>
      <el-input v-model="myConfig.color" class="r_96width r_margin_right8">
      </el-input>
      <el-input
        v-model="myConfig.fontSize"
        class="r_56width"
        oninput="value=value.replace(/[^\d]/g,'')"
      >
        <span slot="suffix" style="line-height: 32px">px</span>
      </el-input>
    </el-form-item>
    <el-form-item label="字体间距" class="form_item_margin">
      <el-slider v-model="myConfig.split" class="slider_thin"></el-slider>
    </el-form-item>
    <el-form-item label="字体行高">
      <el-input-number
        v-model="myConfig.lineHeight"
        controls-position="right"
        class="l_input_number"
      ></el-input-number>
    </el-form-item>
    <el-form-item label="字体背景">
      <l-input-color v-model="myConfig.backgroundColor"></l-input-color>
    </el-form-item>
    <el-form-item label="文字粗细">
      <l-select
        v-model="myConfig.fontWeight"
        :options="dicOption.fontWeightOptions"
      >
      </l-select>
    </el-form-item>
    <el-form-item label="对齐方式">
      <l-select v-model="myConfig.textAlign" :options="dicOption.textAlign">
      </l-select>
    </el-form-item>
    <hr class="hr_color" style="margin-bottom: 2px" />
    <el-collapse accordion>
      <el-collapse-item title="跑马灯设置">
        <el-form-item label="开启">
          <el-switch v-model="myConfig.scroll" class="float_right"></el-switch>
        </el-form-item>
        <template v-if="myConfig.scroll">
          <el-form-item label="滚动速度">
            <el-input v-model="myConfig.speed">
              <span slot="suffix">毫秒</span>
            </el-input>
          </el-form-item>
        </template>
      </el-collapse-item>
      <el-collapse-item title="超链设置">
        <el-form-item label="开启">
          <el-switch v-model="myConfig.link" class="float_right"></el-switch>
        </el-form-item>
        <template v-if="myConfig.link">
          <el-form-item label="打开方式">
            <l-radio v-model="myConfig.linkTarget" :options="dicOption.target">
            </l-radio>
          </el-form-item>
          <el-form-item label="超链地址">
            <el-input v-model="myConfig.linkHref"></el-input>
          </el-form-item>
        </template>
      </el-collapse-item>
    </el-collapse>
  </div>
</template>

<script>
import { dicOption } from "../../mixins/config";
export default {
  props: {
    config: {
      type: Object,
      default: () => ({}),
    },
  },
  inject: ["main"],
  data() {
    return {
      dicOption: dicOption,
    };
  },
  computed: {
    myConfig() {
      return this.config;
    },
  },
};
</script>

<style>
</style>